**Estimate LGB treatment effect using the Nearest-Neighbor Matching Algorithm

clear

/*use appropriate directory containing the Combined105-116_HRC.dta file. This
folder will also then contain the Excel file of output unless an alternative 
location is chosen for the output. */


*only using Democrats b/c no matches for the GOP legislator (Don Young)
drop if democrat==0

eststo NNAll3: teffects nnmatch (hrc nominate_d1 Demvoteshare urban LGBHousehold) (LGBLegislator), ematch(congress) nneighbor(3) atet biasadj(nominate_d1 Demvoteshare urban LGBHousehold) osample(missing) vce(iid) 

outreg2 using  H1Dems_NN.xls, replace ///
label ctitle("All Congress, 3NN ") 
///

eststo NNAll5: teffects nnmatch (hrc nominate_d1 Demvoteshare urban LGBHousehold) (LGBLegislator), ematch(congress)nneighbor(5) atet biasadj(nominate_d1 Demvoteshare urban LGBHousehold) vce(iid)
outreg2 using  H1Dems_NN.xls, append ///
label ctitle("All Congress, 5NN ") 

eststo NNAll7: teffects nnmatch (hrc nominate_d1 Demvoteshare urban LGBHousehold) (LGBLegislator), ematch(congress) nneighbor(7) atet biasadj(nominate_d1 Demvoteshare urban LGBHousehold) vce(iid)
outreg2 using  H1Dems_NN.xls, append ///
label ctitle("All Congress, 7NN ") 

coefplot NNAll3  NNAll5  NNAll7, scheme(s1mono) xline(0) level(90) legend(off) xtitle(Nearest Neighbor stimates for Democratic LGB Legislators)

log close
